package com.thysdy.flowable.controller;

import com.thysdy.flowable.entity.ProcessassignConfig;
import com.thysdy.flowable.entity.RequestVo;
import com.thysdy.flowable.exception.MyException;
import com.thysdy.flowable.service.IProcessassignConfigService;
import com.thysdy.flowable.vo.ReturnVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author ML
 * @since 2020-09-11
 */
@RestController
@RequestMapping("/processassign-config")
public class ProcessassignConfigController {
    @Resource
    IProcessassignConfigService processassignConfigService;

    /**
     * 获取流程最近一次审核人配置
     *
     * @param requestVo
     * @return
     */
    @PostMapping("getLatestProcessAssignConf")
    public ReturnVo getLatestProcessAssignConf(@RequestBody RequestVo requestVo) {
        try {
            ProcessassignConfig config = processassignConfigService.getLatestProcessAssignConf(requestVo);
            return ReturnVo.success(config);
        } catch (MyException e) {
            return ReturnVo.exception(e);
        }
    }
}

